import PlayerDataMgr from "./PlayerDataMgr";
import ResManager from "./ResManager";
import CoinSystem from "./system/CoinSystem";

const {ccclass, property} = cc._decorator;

@ccclass
export default class ClickUnockAll extends cc.Component {

    clickCnt = 0;

    onLoad () {
        this.node.on(cc.Node.EventType.TOUCH_END, ()=>{
            this.clickCnt++;
            if(this.clickCnt == 4){
                CoinSystem.addCoin(10000);
            }
            if(this.clickCnt >= 5) {
                for (let i = 0; i < ResManager.levelResArray.length; ++i) {
                    PlayerDataMgr.getInstance().updateLevelStar(i, 3)
                }
            }
        }, this)
    }
}
